package yesjava;

public class MathDemo {
    private static char [] chars = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
    public static void main(String[] args) {
        /*int abs = Math.abs(-9);
        double pow = Math.pow(2, 4);

        double a = 781.4999999999;
        System.out.println( (int)(a+0.5));*/


      /*  double random = Math.random();// [0,1)
        if (random >= 0.5) {
            System.out.println("OK");
        } else {
            System.out.println("No!");
        }*/

//      [ 23  , 36 ]
//        Math.random() * 14 ==> [0,14) + 23 = [23,37) ===> (int)  [23,37)     ==>  [ 23  , 36 ]

        // 数字  小写字母  大写字母   => 32字符串

       /* StringBuilder strb = new StringBuilder();
        for (int i = 0; i < 32; i++) {
            if((i)%4==0){
                strb.append("-");
            }
            int t = (int) (Math.random() * 3);//0 1 2
            switch (t){
                case 0:
                    strb.append( (char) ((int)( Math.random()*('Z'-'A'+1) + 'A')));
                    break;
                case 1:
                    strb.append( (char) ((int)( Math.random()*('z'-'a'+1) + 'a')));
                    break;
                case 2:
                    strb.append( (char) ((int)( Math.random()*('9'-'0'+1) + '0')));
                    break;
            }

        }
        System.out.println(strb.toString().substring(1));*/

        StringBuilder strb = new StringBuilder();
        for (int i = 0; i < 4; i++) {
            if((i)%4==0){
                strb.append("-");
            }
            strb.append(chars[ (int)(Math.random() * chars.length) ]);// 0 ,chars.length-1
        }
        System.out.println(strb.toString().substring(1));

    }
}
